*** 1.3	1992/03/27 21:49:26
--- c-aux-info.c	1992/03/28 01:56:54
***************
*** 60,66 ****
     BSD systems) now provides getcwd as called for by POSIX.  Allow for
     the few exceptions to the general rule here.  */
  
! #if !(defined (USG) || defined (VMS))
  extern char *getwd ();
  #define getcwd(buf,len) getwd(buf)
  #define GUESSPATHLEN (MAXPATHLEN + 1)
--- 60,66 ----
     BSD systems) now provides getcwd as called for by POSIX.  Allow for
     the few exceptions to the general rule here.  */
  
! #if !(defined (USG) || defined (VMS) || defined(CROSSHPUX))
  extern char *getwd ();
  #define getcwd(buf,len) getwd(buf)
  #define GUESSPATHLEN (MAXPATHLEN + 1)
*** 1.3	1992/03/27 21:49:26
--- c-decl.c	1992/03/28 01:58:02
***************
*** 5388,5393 ****
--- 5388,5395 ----
  
    expand_function_start (fndecl, 0);
  
+ #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
+   /* we will only need this in cp-decl.c, not here */
    /* If this function is `main', emit a call to `__main'
       to run global initializers, etc.  */
    if (DECL_NAME (fndecl)
***************
*** 5394,5399 ****
--- 5396,5402 ----
        && strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main") == 0
        && DECL_CONTEXT (fndecl) == NULL_TREE)
      expand_main_function ();
+ #endif
  }
  
  /* SPECPARMS is an identifier list--a chain of TREE_LIST nodes
*** 1.3	1992/03/27 21:49:26
--- cccp.c	1992/03/28 01:53:14
***************
*** 58,63 ****
--- 58,65 ----
  #undef bzero
  #undef bcmp
  
+ #ifndef atarist
+ 
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <ctype.h>
***************
*** 66,85 ****
  
  #ifndef VMS
  #include <sys/file.h>
! #ifndef USG
  #include <sys/time.h>		/* for __DATE__ and __TIME__ */
  #include <sys/resource.h>
  #else
  #define index strchr
  #define rindex strrchr
  #include <time.h>
  #include <fcntl.h>
! #endif /* USG */
  #endif /* not VMS */
-   
  extern char *index ();
  extern char *rindex ();
  
  /* VMS-specific definitions */
  #ifdef VMS
  #include <time.h>
--- 68,105 ----
  
  #ifndef VMS
  #include <sys/file.h>
! #if (!(defined(USG) || defined(atariminix)))
  #include <sys/time.h>		/* for __DATE__ and __TIME__ */
  #include <sys/resource.h>
  #else
+ #ifndef atariminix
  #define index strchr
  #define rindex strrchr
+ #endif
  #include <time.h>
  #include <fcntl.h>
! #endif /* USG or atariminix */
  #endif /* not VMS */
  extern char *index ();
  extern char *rindex ();
  
+ #else	/* atarist */
+ 
+ #include <ctype.h>
+ #include <stdio.h>
+ #include <types.h>
+ #include <stat.h>
+ #include <file.h>
+ #include <time.h>
+ #include <string.h>
+ #include "stddef.h"
+ 
+ long _stksize = -1L;	/* want big stack cause include files
+ 				   get alloca'ed there */
+ 
+ #endif		/* atarist */
+   
+ 
  /* VMS-specific definitions */
  #ifdef VMS
  #include <time.h>
***************
*** 852,858 ****
--- 872,932 ----
  /* Nonzero means -I- has been seen,
     so don't look for #include "foo" the source-file directory.  */
  static int ignore_srcdir;
+  
+ #ifdef atarist
+ /* a little frobule to filter incoming file data */
+ int eunuchs_read(f, buf, size)
+ int f;
+ char * buf;
+ int size;
+ {
+     char local_buf[1024];
+     register int result_size;
+     register char * local_bufp, * target_bufp;
+     register int buf_size, size_read;
+     
+     for (result_size = 0, target_bufp = buf ; size > 0 ; size -= 1024)
+     { /* do a buffer */
+ 	if (size > 1024)
+ 	    buf_size = 1024;
+ 	else
+ 	    buf_size = size;
+ 	size_read = read(f, &local_buf, buf_size);
+ 	for (local_bufp = (char * ) &local_buf; size_read > 0 ; size_read--)
+ 	    if (*local_bufp == '\r')
+ 		local_bufp++;
+ 	    else
+ 	    {
+ 		*target_bufp++ = *local_bufp++;
+ 		result_size++;
+ 	    }
+     }
+     return(result_size);
+ }
+ 
+ /* the following dingus is used in place of some calls to bcopy,
+    to ensure that backslashes get properly slashified when getting
+    shoved into strings.  Note that it returns the new pointer!!
+    There ought to be a better way... */
+ 
+ U_CHAR * slashifying_bcopy(from_buf, to_buf, nbytes)
+ U_CHAR * from_buf, * to_buf;
+ int nbytes;
+ {
+   for ( ; nbytes > 0 ; )
+ 	{
+ 	if(*from_buf == '\\')
+ 		*to_buf++ = '\\';
+ 	*to_buf++ = *from_buf++;
+ 	nbytes--;
+ 	}
+   return(to_buf);
+ }
+ #define read(a, b, c) eunuchs_read(a, b, c)
+ 
+ #endif		/* atarist */
  
+ #ifndef atarist
  /* Handler for SIGPIPE.  */
  
  static void
***************
*** 862,867 ****
--- 936,942 ----
  {
    fatal ("output pipe has been closed");
  }
+ #endif /* atarist */
  
  int
  main (argc, argv)
***************
*** 896,901 ****
--- 971,981 ----
    /* Target-name to write with the dependency information.  */
    char *deps_target = 0;
  
+ #ifdef atarist
+ /* turn this on if you are going to set the TOS 1.4 dont clear heap flag */
+ /*  _malloczero(1); */ 	/* zero mallocs by default */
+ #endif  
+ 
  #ifdef RLIMIT_STACK
    /* Get rid of any avoidable limit on stack size.  */
    {
***************
*** 944,949 ****
--- 1024,1030 ----
    signal (SIGPIPE, pipe_closed);
  #endif
  
+ #ifndef atarist
    for (i = 0; include_defaults[i].fname; i++)
      max_include_len = MAX (max_include_len,
  			   strlen (include_defaults[i].fname));
***************
*** 951,957 ****
  #ifdef VMS
    max_include_len += 10;
  #endif
! 
    bzero (pend_files, argc * sizeof (char *));
    bzero (pend_defs, argc * sizeof (char *));
    bzero (pend_undefs, argc * sizeof (char *));
--- 1032,1041 ----
  #ifdef VMS
    max_include_len += 10;
  #endif
! #else
!   max_include_len = 80;	/* arbitrary value */
! #endif
!   
    bzero (pend_files, argc * sizeof (char *));
    bzero (pend_defs, argc * sizeof (char *));
    bzero (pend_undefs, argc * sizeof (char *));
***************
*** 1154,1163 ****
--- 1238,1253 ----
  	break;
  
        case 'v':
+ #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
+ #include "PatchLev.h"
+ 	fprintf (stderr, "GNU CPP-atariST version %s Patchlevel %s",
+ 		 version_string, PatchLevel);
+ #else
  	fprintf (stderr, "GNU CPP version %s", version_string);
  #ifdef TARGET_VERSION
  	TARGET_VERSION;
  #endif
+ #endif
  	fprintf (stderr, "\n");
  	break;
  
***************
*** 1291,1296 ****
--- 1381,1387 ----
      }
    }
  
+ #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
    /* Add dirs from CPATH after dirs from -I.  */
    /* There seems to be confusion about what CPATH should do,
       so for the moment it is not documented.  */
***************
*** 1300,1305 ****
--- 1391,1397 ----
    p = (char *) getenv ("CPATH");
    if (p != 0 && ! no_standard_includes)
      path_include (p);
+ #endif
  
    /* Now that dollars_in_ident is known, initialize is_idchar.  */
    initialize_char_syntax ();
***************
*** 1423,1430 ****
    { /* read the appropriate environment variable and if it exists
         replace include_defaults with the listed path. */
      char *epath = 0;
      switch ((objc << 1) + cplusplus)
!       {
        case 0:
  	epath = getenv ("C_INCLUDE_PATH");
  	break;
--- 1515,1560 ----
    { /* read the appropriate environment variable and if it exists
         replace include_defaults with the listed path. */
      char *epath = 0;
+ #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
+     char *e1 = getenv("GNUINC"), *e2 = getenv("GNULIB"),
+          *e3 = getenv("GXXINC");
+ 
+     if(cplusplus)
+     {
+ 	if(e3)
+ 	    epath = strcpy(alloca(strlen(e3)+1), e3);
+     }
+     if(e1)
+     {
+       if(epath)
+ 	epath = strcat(
+ #ifdef atarist
+ 	 strcat(strcpy(alloca(strlen(epath)+strlen(e1)+2), epath), ","),
+ 		       e1);
+ #else
+ 	 strcat(strcpy(alloca(strlen(epath)+strlen(e1)+2), epath), ":"),
+ 		       e1);
+ #endif
+       else
+ 	epath = strcpy(alloca(strlen(e1)+1), e1);
+     }
+     if(e2)
+     {
+       if(epath)
+ 	epath = strcat(
+ #ifdef atarist
+ 	 strcat(strcpy(alloca(strlen(epath)+strlen(e2)+2), epath), ","),
+ 		       e2);
+ #else
+ 	 strcat(strcpy(alloca(strlen(epath)+strlen(e2)+2), epath), ":"),
+ 		       e2);
+ #endif
+       else
+ 	epath = strcpy(alloca(strlen(e2)+1), e2);
+     }
+ #else
      switch ((objc << 1) + cplusplus)
!     {
        case 0:
  	epath = getenv ("C_INCLUDE_PATH");
  	break;
***************
*** 1437,1443 ****
        case 3:
  	epath = getenv ("OBJCPLUS_INCLUDE_PATH");
  	break;
!       }
      /* If the environment var for this language is set,
         add to the default list of include directories.  */
      if (epath) {
--- 1567,1575 ----
        case 3:
  	epath = getenv ("OBJCPLUS_INCLUDE_PATH");
  	break;
!     }
! #endif
!     
      /* If the environment var for this language is set,
         add to the default list of include directories.  */
      if (epath) {
***************
*** 1446,1452 ****
--- 1578,1588 ----
        char *startp, *endp;
  
        for (num_dirs = 1, startp = epath; *startp; startp++)
+ #ifdef atarist
+ 	if ((*startp == ';') || (*startp == ','))
+ #else
  	if (*startp == ':')
+ #endif
  	  num_dirs++;
        include_defaults
  	= (struct default_include *) xmalloc ((num_dirs
***************
*** 1456,1461 ****
--- 1592,1598 ----
        num_dirs = 0;
        while (1) {
          /* Handle cases like c:/usr/lib:d:/gcc/lib */
+ #ifndef atarist
          if ((*endp == ':'
  #ifdef __MSDOS__
  	     && (endp-startp != 1 || !isalpha (*startp)))
***************
*** 1462,1467 ****
--- 1599,1607 ----
  #endif
  	     )
              || (*endp == 0)) {
+ #else
+ 	if ((*endp == ';') || (*endp == ',') || (*endp == '\0')) {
+ #endif
  	  strncpy (nstore, startp, endp-startp);
  	  if (endp == startp)
  	    strcpy (nstore, ".");
***************
*** 1488,1495 ****
--- 1628,1643 ----
       tack on the standard include file dirs to the specified list */
    if (!no_standard_includes) {
      struct default_include *p = include_defaults;
+ #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
+     char *specd_prefix = NULL;
+ #else
      char *specd_prefix = getenv ("GCC_EXEC_PREFIX");
+ #endif
+ #ifdef GCC_INCLUDE_DIR
      char *default_prefix = savestring (GCC_INCLUDE_DIR);
+ #else
+     char *default_prefix = savestring ("./");
+ #endif
      int default_len = 0;
      /* Remove the `include' from /usr/local/lib/gcc.../include.  */
      if (!strcmp (default_prefix + strlen (default_prefix) - 8, "/include")) {
***************
*** 1496,1501 ****
--- 1644,1655 ----
        default_len = strlen (default_prefix) - 7;
        default_prefix[default_len] = 0;
      }
+ #ifdef atarist
+     else if (!strcmp (default_prefix + strlen (default_prefix) - 8, "\\include")) {
+       default_len = strlen (default_prefix) - 7;
+       default_prefix[default_len] = 0;
+     }
+ #endif
      /* Search "translated" versions of GNU directories.
         These have /usr/local/lib/gcc... replaced by specd_prefix.  */
      if (specd_prefix != 0 && default_len != 0)
***************
*** 1650,1656 ****
--- 1804,1814 ----
        char *p1 = p;
        /* Discard all directory prefixes from P.  */
        while (*p1) {
+ #ifdef atarist
+ 	if ((*p1 == '/') || (*p1 == '\\'))
+ #else
  	if (*p1 == '/')
+ #endif
  	  p = p1 + 1;
  	p1++;
        }
***************
*** 1810,1815 ****
--- 1968,1974 ----
    return 0;
  }
  
+ #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
  /* Given a colon-separated list of file names PATH,
     add all the names to the search path for include files.  */
  
***************
*** 1869,1874 ****
--- 2028,2034 ----
        p++;
      }
  }
+ #endif
  
  /* Pre-C-Preprocessor to translate ANSI trigraph idiocy in BUF
     before main CCCP processing.  Name `pcp' is also in honor of the
***************
*** 3453,3460 ****
--- 3613,3629 ----
  
        if (string)
  	{
+ #ifndef atarist
  	  buf = (char *) alloca (3 + strlen (string));
  	  sprintf (buf, "\"%s\"", string);
+ #else
+     	  buf = (char *) alloca (16 + strlen (string));
+           {
+ 	      char *tbuf = (char *) alloca (16 + strlen (string));
+ 	      (void) slashifying_bcopy(string, tbuf, strlen(string)+1);
+ 	      sprintf (buf, "\"%s\"", tbuf);
+           }
+ #endif /* atarist */
  	}
        else
  	buf = "\"\"";
***************
*** 3657,3663 ****
--- 3826,3837 ----
  	    dsp[0].next = search_start;
  	    search_start = dsp;
  #ifndef VMS
+ #ifdef atarist
+ 	    if((ep = rindex(nam, '\\')) == NULL)
+ 		ep = rindex(nam, '/');
+ #else
  	    ep = rindex (nam, '/');
+ #endif
  #else				/* VMS */
  	    ep = rindex (nam, ']');
  	    if (ep == NULL) ep = rindex (nam, '>');
***************
*** 3733,3741 ****
--- 3907,3929 ----
  
    /* If specified file name is absolute, just open it.  */
  
+ #ifdef atarist
+   if ((*fbeg == '\\') || (*fbeg == '/')) {
+     if(fbeg[2] == ':')
+     { /* allow "\D:\xxx" */
+         strncpy (fname, fbeg+1, flen-1);
+         fname[flen-1] = 0;
+     }
+     else
+     {  /* allow "\lib\xxx" == "\currentdrive:\lib\xxx" */
+         strncpy (fname, fbeg, flen);
+         fname[flen] = 0;
+     }
+ #else
    if (*fbeg == '/') {
      strncpy (fname, fbeg, flen);
      fname[flen] = 0;
+ #endif
      if (lookup_include (fname))
        return 0;
      if (importing)
***************
*** 3756,3762 ****
--- 3944,3954 ----
  	if (searchptr->fname[0] == 0)
  	  continue;
  	strcpy (fname, searchptr->fname);
+ #ifdef atarist
+ 	strcat (fname, "\\");
+ #else
  	strcat (fname, "/");
+ #endif
  	fname[strlen (fname) + flen] = 0;
        } else {
  	fname[0] = 0;
***************
*** 6675,6682 ****
--- 6867,6878 ----
    check_expand (op, len + 1);
    if (op->bufp > op->buf && op->bufp[-1] != '\n')
      *op->bufp++ = '\n';
+ #ifdef atarist
+   op->bufp = slashifying_bcopy (line_cmd_buf, op->bufp, len);
+ #else
    bcopy (line_cmd_buf, op->bufp, len);
    op->bufp += len;
+ #endif
    op->lineno = ip->lineno;
  }
  
***************
*** 8247,8252 ****
--- 8443,8449 ----
    deps_buffer[deps_size] = 0;
  }
  
+ #if (!(defined(atarist) || defined(atariminix)))
  #if defined(USG) || defined(VMS)
  #ifndef BSTRING
  
***************
*** 8314,8320 ****
  }
  #endif /* not BSTRING */
  #endif /* USG or VMS */
! 
  
  static void
  fatal (str, arg)
--- 8511,8517 ----
  }
  #endif /* not BSTRING */
  #endif /* USG or VMS */
! #endif /* any atari */
  
  static void
  fatal (str, arg)
*** 1.3	1992/03/27 21:49:26
--- cp-tree.c	1992/03/28 01:50:21
***************
*** 1579,1584 ****
--- 1579,1585 ----
    print_class_statistics ();
  }
  
+ #ifndef atarist
  /* This is used by the `assert' macro.  It is provided in libgcc.a,
     which `cc' doesn't know how to link.  */
  void
***************
*** 1599,1604 ****
--- 1600,1606 ----
    fflush (stderr);
    abort ();
  }
+ #endif
  
  /* Return, as an INTEGER_CST node, the number of elements for
     TYPE (which is an ARRAY_TYPE).  This counts only elements of the top array. */
*** 1.3	1992/03/27 21:49:26
--- dbxout.c	1992/03/28 02:47:32
***************
*** 138,143 ****
--- 138,146 ----
  #if defined (USG) || defined (NO_STAB_H)
  #include "gstab.h"  /* If doing DBX on sysV, use our own stab.h.  */
  #else
+ #if defined(CROSSATARI) || defined(atarist) || defined(atariminix)
+ #include "astab.h"
+ #else
  #include <stab.h>  /* On BSD, use the system's stab.h.  */
  
  /* This is a GNU extension we need to reference in this file.  */
***************
*** 145,150 ****
--- 148,154 ----
  #define N_CATCH 0x54
  #endif
  #endif /* not USG */
+ #endif
  
  #ifdef __GNU_STAB__
  #define STAB_CODE_TYPE enum __stab_debug_code
***************
*** 400,407 ****
--- 404,417 ----
  #ifdef DBX_OUTPUT_MAIN_SOURCE_DIRECTORY
  	  DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (asmfile, cwd);
  #else /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
+ #ifndef atarist
  	  fprintf (asmfile, "%s \"%s/\",%d,0,0,%s\n", ASM_STABS_OP,
  		   cwd, N_SO, &ltext_label_name[1]);
+ #else
+ 	fprintf (asmfile, "%s \"", ASM_STABS_OP);
+ 	atari_output_filename(asmfile, cwd);
+ 	fprintf (asmfile, "\\\\\",%d,0,0,%s\n", N_SO, &ltext_label_name[1]);
+ #endif
  #endif /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
  	}
      }
***************
*** 414,421 ****
--- 424,437 ----
    /* We include outputting `Ltext:' here,
       because that gives you a way to override it.  */
    /* Used to put `Ltext:' before the reference, but that loses on sun 4.  */
+ #ifndef atarist
    fprintf (asmfile, "%s \"%s\",%d,0,0,%s\n", ASM_STABS_OP, input_file_name,
  	   N_SO, &ltext_label_name[1]);
+ #else
+   fprintf (asmfile, "%s \"", ASM_STABS_OP);
+   atari_output_filename(asmfile, input_file_name);
+   fprintf(asmfile, "\",%d,0,0,%s\n", N_SO, &ltext_label_name[1]);
+ #endif
    text_section ();
    ASM_OUTPUT_INTERNAL_LABEL (asmfile, "Ltext", 0);
  #endif /* no DBX_OUTPUT_MAIN_SOURCE_FILENAME */
***************
*** 481,488 ****
--- 497,510 ----
        DBX_OUTPUT_SOURCE_FILENAME (file, filename);
  #else
        ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0);
+ #ifndef atarist
        fprintf (file, "%s \"%s\",%d,0,0,%s\n", ASM_STABS_OP,
  	       filename, N_SOL, &ltext_label_name[1]);
+ #else
+       fprintf (file, "%s \"", ASM_STABS_OP);
+       atari_output_filename(file, filename);
+       fprintf (file, "\",%d,0,0,%s\n", N_SOL, &ltext_label_name[1]);
+ #endif
  #endif
        lastfile = filename;
      }
*** 1.3	1992/03/27 21:49:26
--- final.c	1992/03/28 02:02:34
***************
*** 67,74 ****
--- 67,78 ----
  #if defined (USG) || defined (NO_STAB_H)
  #include "gstab.h"  /* If doing DBX on sysV, use our own stab.h.  */
  #else
+ #if defined(CROSSATARI) || defined(atarist) || defined(atariminix)
+ #include "astab.h"
+ #else
  #include <stab.h>  /* On BSD, use the system's stab.h.  */
  #endif /* not USG */
+ #endif /* not atari */
  #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
  
  #ifdef XCOFF_DEBUGGING_INFO
*** 1.4	1992/03/27 21:49:26
--- gcc.c	1992/03/28 03:53:11
***************
*** 30,35 ****
--- 30,44 ----
  Once it knows which kind of compilation to perform, the procedure for
  compilation is specified by a string called a "spec".  */
  
+ #ifdef CROSSATARI
+ #ifdef atarist
+ #undef atarist
+ #endif
+ #ifdef atariminix
+ #undef atariminix
+ #endif
+ #endif
+   
  #include <stdio.h>
  #include <sys/types.h>
  #include <ctype.h>
***************
*** 36,47 ****
  #include <signal.h>
  #include <sys/file.h>
  #include <sys/stat.h>
  
  #include "config.h"
  #include "obstack.h"
  #include "gvarargs.h"
  
! #ifdef USG
  #ifndef R_OK
  #define R_OK 4
  #define W_OK 2
--- 45,59 ----
  #include <signal.h>
  #include <sys/file.h>
  #include <sys/stat.h>
+ #ifdef CROSSATARI
+ #include <ctype.h>
+ #endif
  
  #include "config.h"
  #include "obstack.h"
  #include "gvarargs.h"
  
! #if (defined(USG) || defined(atariminix))
  #ifndef R_OK
  #define R_OK 4
  #define W_OK 2
***************
*** 78,83 ****
--- 90,102 ----
  #endif
  #endif
  
+ #ifdef atarist
+ #include <osbind.h>
+ #include <ctype.h>
+ #include <fcntl.h>		/* fgth, for redirection of stderr */
+ long _stksize = 8192;
+ #endif
+ 
  #define obstack_chunk_alloc xmalloc
  #define obstack_chunk_free free
  
***************
*** 129,135 ****
--- 148,156 ----
     pass the compiler in building the list of pointers to constructors
     and destructors.  */
  
+ #if (!(defined(CROSSATARI) || defined(atarist)))
  static struct obstack collect_obstack;
+ #endif
  
  extern char *version_string;
  
***************
*** 401,406 ****
--- 422,430 ----
          -undef -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
  	%{!undef:%{!ansi:%p} %P} %{trigraphs}\
          %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
+         %{mshort:-D__MSHORT__} %{mint:-D__MINT__}\
+         %{m68881:-D__M68881__} %{m68020:-D__M68020__}\
+         %{mc68881:-D__M68881__} %{mc68020:-D__M68020__}\
          %{traditional-cpp:-traditional}\
  	%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
          %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n\
***************
*** 411,417 ****
  		   %{aux-info*}\
  		   %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!               %{!S:as %{R} %{j} %{J} %{h} %{d2} %a \
  		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
                        %{!pipe:%g.s} %A\n }}}}"},
    {"-",
--- 435,441 ----
  		   %{aux-info*}\
  		   %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!               %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a \
  		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
                        %{!pipe:%g.s} %A\n }}}}"},
    {"-",
***************
*** 421,426 ****
--- 445,453 ----
          -undef -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
  	%{!undef:%{!ansi:%p} %P} %{trigraphs}\
          %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
+         %{mshort:-D__MSHORT__} %{mint:-D__MINT__}\
+         %{m68881:-D__M68881__} %{m68020:-D__M68020__}\
+         %{mc68881:-D__M68881__} %{mc68020:-D__M68020__}\
          %{traditional-cpp:-traditional}\
  	%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
          %i %W{o*}}\
***************
*** 433,438 ****
--- 460,468 ----
          -undef -D__OBJC__ -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
  	%{!undef:%{!ansi:%p} %P} %{trigraphs}\
          %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
+         %{mshort:-D__MSHORT__} %{mint:-D__MINT__}\
+         %{m68881:-D__M68881__} %{m68020:-D__M68020__}\
+         %{mc68881:-D__M68881__} %{mc68020:-D__M68020__}\
          %{traditional-cpp:-traditional}\
  	%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
          %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n\
***************
*** 444,450 ****
  		   %{aux-info*}\
  		   %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!               %{!S:as %{R} %{j} %{J} %{h} %{d2} %a \
  		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
                        %{!pipe:%g.s} %A\n }}}}"},
    {".h", "@c-header"},
--- 474,480 ----
  		   %{aux-info*}\
  		   %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!               %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a \
  		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
                        %{!pipe:%g.s} %A\n }}}}"},
    {".h", "@c-header"},
***************
*** 456,461 ****
--- 486,494 ----
          -undef -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
  	%{!undef:%{!ansi:%p} %P} %{trigraphs}\
          %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
+         %{mshort:-D__MSHORT__} %{mint:-D__MINT__}\
+         %{m68881:-D__M68881__} %{m68020:-D__M68020__}\
+         %{mc68881:-D__M68881__} %{mc68020:-D__M68020__}\
          %{traditional-cpp:-traditional}\
  	%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
          %i %W{o*}"},
***************
*** 469,474 ****
--- 502,510 ----
  	-undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus \
  	%{ansi:-trigraphs -$ -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
          %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
+         %{mshort:-D__MSHORT__} %{mint:-D__MINT__}\
+         %{m68881:-D__M68881__} %{m68020:-D__M68020__}\
+         %{mc68881:-D__M68881__} %{mc68020:-D__M68020__}\
          %{traditional-cpp:-traditional} %{trigraphs}\
  	%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
          %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n\
***************
*** 479,485 ****
  		   %{aux-info*}\
  		   %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!               %{!S:as %{R} %{j} %{J} %{h} %{d2} %a \
  		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
                        %{!pipe:%g.s} %A\n }}}}"},
    {".i", "@cpp-output"},
--- 515,521 ----
  		   %{aux-info*}\
  		   %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!               %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a \
  		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
                        %{!pipe:%g.s} %A\n }}}}"},
    {".i", "@cpp-output"},
***************
*** 490,496 ****
  	%{aux-info*}\
  	%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  	%{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!     %{!S:as %{R} %{j} %{J} %{h} %{d2} %a \
              %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o} %{!pipe:%g.s} %A\n }"},
    {".ii", "@c++-cpp-output"},
    {"@c++-cpp-output",
--- 526,532 ----
  	%{aux-info*}\
  	%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  	%{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!     %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a \
              %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o} %{!pipe:%g.s} %A\n }"},
    {".ii", "@c++-cpp-output"},
    {"@c++-cpp-output",
***************
*** 500,511 ****
  	    %{aux-info*}\
  	    %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  	    %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!        %{!S:as %{R} %{j} %{J} %{h} %{d2} %a \
  	       %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
  	       %{!pipe:%g.s} %A\n }"},
    {".s", "@assembler"},
    {"@assembler",
!    "%{!S:as %{R} %{j} %{J} %{h} %{d2} %a \
              %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o} %i %A\n }"},
    {".S", "@assembler-with-cpp"},
    {"@assembler-with-cpp",
--- 536,547 ----
  	    %{aux-info*}\
  	    %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  	    %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!        %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a \
  	       %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
  	       %{!pipe:%g.s} %A\n }"},
    {".s", "@assembler"},
    {"@assembler",
!    "%{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a \
              %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o} %i %A\n }"},
    {".S", "@assembler-with-cpp"},
    {"@assembler-with-cpp",
***************
*** 514,523 ****
  	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{trigraphs} \
          -undef -$ %{!undef:%p %P} -D__ASSEMBLER__ \
          %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
          %{traditional-cpp:-traditional}\
  	%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
          %i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n\
!     %{!M:%{!MM:%{!E:%{!S:as %{R} %{j} %{J} %{h} %{d2} %a \
                      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
  		    %{!pipe:%g.s} %A\n }}}}"},
    /* Mark end of table */
--- 550,562 ----
  	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{trigraphs} \
          -undef -$ %{!undef:%p %P} -D__ASSEMBLER__ \
          %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
+         %{mshort:-D__MSHORT__} %{mint:-D__MINT__}\
+         %{m68881:-D__M68881__} %{m68020:-D__M68020__}\
+         %{mc68881:-D__M68881__} %{mc68020:-D__M68020__}\
          %{traditional-cpp:-traditional}\
  	%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
          %i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n\
!     %{!M:%{!MM:%{!E:%{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a \
                      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
  		    %{!pipe:%g.s} %A\n }}}}"},
    /* Mark end of table */
***************
*** 531,536 ****
--- 570,584 ----
  
  /* Here is the spec for running the linker, after compiling all files.  */
  
+ #if (defined(CROSSATARI) || defined(atarist) || defined(atariminix))
+ static char *link_command_spec = 
+  "%{!c:%{!M*:%{!E:%{!S:ld %{v} %{G} %{o*} %l\
+  %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\
+  %{y*} %{!nostdlib:%S} \
+  %{L*} %o %{!nostdlib:%s %L}\n }}}}";
+ 
+ #else
+ 
  #ifdef LINK_LIBGCC_SPECIAL
  /* Have gcc do the search.  */
  static char *link_command_spec = "\
***************
*** 546,551 ****
--- 594,600 ----
  			%{!A:%{!nostdlib:%S}} \
  			%{L*} %D %o %{!nostdlib:-lgcc %L -lgcc %{!A:%E}}\n }}}}}";
  #endif
+ #endif
  
  /* A vector of options to give to the linker.
     These options are accumlated by %x
***************
*** 553,558 ****
--- 602,608 ----
  static int n_linker_options;
  static char **linker_options;
  
+ #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
  /* Read compilation specs from a file named FILENAME,
     replacing the default ones.
  
***************
*** 689,694 ****
--- 739,745 ----
  
    return p;
  }
+ #endif /* ataris */
  
  /* Structure to keep track of the specs that have been defined so far.  These
     are accessed using %(specname) or %[specname] in a compiler or link spec. */
***************
*** 789,794 ****
--- 840,852 ----
  /* Name with which this program was invoked.  */
  
  static char *programname;
+ 
+ #ifdef atarist
+ /* Flag indicating, that stderr should be redirected for the child
+    processes */
+ 
+ unsigned char zflag;
+ #endif
  
  /* Structures to keep track of prefixes to try when looking for files. */
  
***************
*** 1030,1038 ****
  static void
  choose_temp_base ()
  {
-   char *base = getenv ("TMPDIR");
    int len;
  
    if (base == (char *)0)
      {
  #ifdef P_tmpdir
--- 1088,1113 ----
  static void
  choose_temp_base ()
  {
    int len;
+ #if (!(defined(atarist) || defined(atariminix)))
+   char *base = getenv ("TMPDIR");
+ #else
+   char *base = getenv ("TEMP");
  
+   if(base == (char *)0)
+   {
+       base = getenv("TMPDIR");
+       if(base == (char *)0)
+       base = getenv("TMP");
+   }
+   if(base != (char *)0)
+   {
+       char *newbase = alloca(FILENAME_MAX);
+       dos2unx(base,newbase);
+       base = newbase;
+   }
+ #endif
+ 
    if (base == (char *)0)
      {
  #ifdef P_tmpdir
***************
*** 1051,1057 ****
    len = strlen (base);
    temp_filename = xmalloc (len + sizeof("/ccXXXXXX"));
    strcpy (temp_filename, base);
!   if (len > 0 && temp_filename[len-1] != '/')
      temp_filename[len++] = '/';
    strcpy (temp_filename + len, "ccXXXXXX");
  
--- 1126,1136 ----
    len = strlen (base);
    temp_filename = xmalloc (len + sizeof("/ccXXXXXX"));
    strcpy (temp_filename, base);
!   if (len > 0 && (temp_filename[len-1] != '/' 
! #ifdef atarist
! 		  || temp_filename[len-1] != '\\'
! #endif
!  		  ))
      temp_filename[len++] = '/';
    strcpy (temp_filename + len, "ccXXXXXX");
  
***************
*** 1068,1073 ****
--- 1147,1153 ----
     use come from an obstack, we don't have to worry about allocating
     space for them.  */
  
+ #if (!(defined(CROSSATARI) || defined(atarist)))
  #ifndef HAVE_PUTENV
  
  putenv (str)
***************
*** 1154,1159 ****
--- 1234,1240 ----
    obstack_grow (&collect_obstack, "\0", 1);
    putenv (obstack_finish (&collect_obstack));
  }
+ #endif /* ataris */
  
  
  /* Search for NAME using the prefix list PREFIXES.  MODE is passed to
***************
*** 1389,1394 ****
--- 1470,1476 ----
  
  #else /* not __MSDOS__ */
  
+ #ifndef atarist
  static int
  pexecute (func, program, argv, not_last)
       char *program;
***************
*** 1476,1481 ****
--- 1558,1564 ----
      }
  }
  
+ #endif /* not atarist */
  #endif /* not __MSDOS__ */
  
  /* Execute the command specified by the arguments on the current line of spec.
***************
*** 1494,1509 ****
      {
        char *prog;		/* program name.  */
        char **argv;		/* vector of args.  */
        int pid;			/* pid of process for this command.  */
      };
  
    struct command *commands;	/* each command buffer with above info.  */
  
    /* Count # of piped commands.  */
    for (n_commands = 1, i = 0; i < argbuf_index; i++)
      if (strcmp (argbuf[i], "|") == 0)
        n_commands++;
! 
    /* Get storage for each command.  */
    commands
      = (struct command *) alloca (n_commands * sizeof (struct command));
--- 1577,1597 ----
      {
        char *prog;		/* program name.  */
        char **argv;		/* vector of args.  */
+ #ifndef atarist
        int pid;			/* pid of process for this command.  */
+ #endif
      };
  
    struct command *commands;	/* each command buffer with above info.  */
  
+ #ifndef atarist
    /* Count # of piped commands.  */
    for (n_commands = 1, i = 0; i < argbuf_index; i++)
      if (strcmp (argbuf[i], "|") == 0)
        n_commands++;
! #else
!   n_commands = 1;
! #endif
    /* Get storage for each command.  */
    commands
      = (struct command *) alloca (n_commands * sizeof (struct command));
***************
*** 1518,1523 ****
--- 1606,1612 ----
    if (string)
      commands[0].argv[0] = string;
  
+ #ifndef atarist
    for (n_commands = 1, i = 0; i < argbuf_index; i++)
      if (strcmp (argbuf[i], "|") == 0)
        {				/* each command.  */
***************
*** 1532,1537 ****
--- 1621,1629 ----
  	  commands[n_commands].argv[0] = string;
  	n_commands++;
        }
+ #else
+   n_commands = 1;
+ #endif
  
    argbuf[argbuf_index] = 0;
  
***************
*** 1547,1555 ****
--- 1639,1649 ----
  	  for (j = commands[i].argv; *j; j++)
  	    fprintf (stderr, " %s", *j);
  
+ #ifndef atarist
  	  /* Print a pipe symbol after all but the last command.  */
  	  if (i + 1 != n_commands)
  	    fprintf (stderr, " |");
+ #endif
  	  fprintf (stderr, "\n");
  	}
        fflush (stderr);
***************
*** 1564,1574 ****
--- 1658,1670 ----
  #endif /* DEBUG */
      }
  
+ #ifndef atarist
    /* Run each piped subprocess.  */
  
    last_pipe_input = STDIN_FILE_NO;
    for (i = 0; i < n_commands; i++)
      {
+ #ifndef atariminix
        char *string = commands[i].argv[0];
  
        commands[i].pid = pexecute ((string != commands[i].prog ? execv : execvp),
***************
*** 1575,1580 ****
--- 1671,1684 ----
  				  string, commands[i].argv,
  				  i + 1 < n_commands);
  
+ #else
+       extern int execv();
+       char *string = commands[i].argv[0];
+ 
+       commands[i].pid = pexecute (execv,
+ 				  string, commands[i].argv,
+ 				  i + 1 < n_commands);
+ #endif
        if (string != commands[i].prog)
  	free (string);
      }
***************
*** 1618,1623 ****
--- 1722,1772 ----
        }
      return ret_code;
    }
+ #else /* atarist */
+  {
+      register int iii;
+      int errfd, oldfd;
+      char **j;
+ 
+      execution_count++;
+ 
+      if (zflag)
+        {
+ 	 errfd = Fopen("compile.err", 2);
+ 	 if (errfd < __SMALLEST_VALID_HANDLE)
+ 	   errfd = Fcreate("compile.err", 0);
+ 	 else
+ 	   Fseek(0L, errfd, 2);
+ 	 if (errfd >= __SMALLEST_VALID_HANDLE)
+ 	   {
+ 	     oldfd = Fdup (2);
+ 	     Fforce(2, errfd);
+ 	   }
+ 	 else
+ 	   {
+ 	     error("cannot open %s", "compile.err");
+ 	     zflag = 0;		/* no redirection */
+ 	   }
+        }
+      for (i = 0; i < n_commands ; i++)
+      {
+          j = commands[i].argv;
+          iii = spawnve(0, j[0], j, NULL);
+ 	 if(iii != 0)
+ 	     break;
+      }
+      if (zflag)
+        {
+ 	 Fforce(2, oldfd);
+ 	 Fclose(oldfd);
+ 	 Fclose(errfd);
+        }
+      if (iii != 0)
+        return -1;
+      else
+        return 0;
+  }
+ #endif /* atarist */  
  }
  
  /* Find all the switches given to us
***************
*** 1675,1680 ****
--- 1824,1830 ----
  
    /* Set up the default search paths.  */
  
+ #ifndef CROSSATARI
    temp = getenv ("GCC_EXEC_PREFIX");
    if (temp)
      {
***************
*** 1752,1757 ****
--- 1902,1908 ----
  	    endp++;
  	}
      }
+ #endif /* CROSSATARI */
  
    /* Use LPATH like LIBRARY_PATH (for the CMU build program).  */
    temp = getenv ("LPATH");
***************
*** 1887,1892 ****
--- 2038,2049 ----
  		  save_temps_flag = 1;
  		  break;
  		}
+ #ifdef atarist
+ 	    case 'z':	/* redirect stderr to a file */
+ 	      zflag++;
+ 	      n_switches++;
+ 	      break;
+ #endif
  	    default:
  	      n_switches++;
  
***************
*** 2042,2047 ****
--- 2199,2213 ----
     search dirs for it.  */
  static int this_is_library_file;
  
+ #ifdef atarist
+ /* I don't know why this is necessary.  Recursive calls to do_spec_1
+    end up ignoring the error code from calls to execute().  That causes
+    do_spec to get a 0 return value, and do_spec_1("\n"), which causes the
+    command to get executed again.
+ */
+ int execute_return_error = 0;
+ #endif
+ 
  /* Process the spec SPEC and run the commands specified therein.
     Returns 0 if the spec is successfully processed; -1 if failed.  */
  
***************
*** 2061,2070 ****
--- 2227,2245 ----
  
    /* Force out any unfinished command.
       If -pipe, this forces out the last command if it ended in `|'.  */
+ #ifdef atarist
+   if (!value && execute_return_error)
+ 	{
+ 	value = execute_return_error;
+ 	execute_return_error = 0;
+ 	}
+ #endif
    if (value == 0)
      {
+ #ifndef atarist
        if (argbuf_index > 0 && !strcmp (argbuf[argbuf_index - 1], "|"))
  	argbuf_index--;
+ #endif
  
        if (argbuf_index > 0)
  	value = execute ();
***************
*** 2101,2106 ****
--- 2276,2332 ----
         Otherwise, NL, SPC, TAB and % are special.  */
      switch (inswitch ? 'a' : c)
        {
+ #if (defined(atarist) || defined(CROSSATARI))
+ /* this stuff added by jrd.  if see '$', expect name of env var, delimited
+    by '$'.  Find it's value, and subst it in.
+ 
+    modified by ERS to only collect things that look like names; this
+    saves e.g. the -$ arg. to cpp from getting munged */
+ 
+       case '$':
+       {
+ 	char varname[32];		/* should be enough */
+ 	char * value;			/* deciphered value string */
+ 	char *temp;
+ 	int i;
+ 	extern char *getenv(), *index();
+ 	
+ 	for (i = 0 ; ((c = *p) != '$') && isalnum(c) && i < 31 ; i++, p++)
+ 		varname[i] = c;
+ 	varname[i] = '\0';
+ 	if (strlen(varname) > 0) /* ++jrb fix */
+ 	{
+              	++p;    /* skip trailing '$' */
+ 		value = getenv(varname); /* ++jrb fix */
+ 		if (value)
+ 		{ /* if value is a path, only consider 1'st component */
+ #ifdef atarist
+ 			if((temp = index(value, ',')) == NULL)
+ 			    temp = index(value, ';');
+ #else
+ 			temp = index(value, ':');
+ #endif
+ 			if(temp != NULL)
+ 			{
+ 			    char *t = (char *) alloca(strlen(value) + 1);
+ 			    strcpy(t, value);
+ 			    t[temp-value] = '\0';
+ 			    do_spec_1(t, 0);
+ 			}
+ 			else
+ 			    do_spec_1(value, 0);
+ 		}
+ 		    else
+ 			do_spec_1(".", 0);	/* a compleat kludge... */
+ 	}
+         else
+         {
+              obstack_1grow(&obstack, '$');
+              arg_going = 1;
+         }
+       }
+      break;
+ #endif /* atarist */
        case '\n':
  	/* End of line: finish any pending argument,
  	   then run the pending command if one has been started.  */
***************
*** 2138,2143 ****
--- 2364,2373 ----
  	if (argbuf_index > 0)
  	  {
  	    int value = execute ();
+ #ifdef atarist
+ 		if (!execute_return_error)
+ 			execute_return_error = value;
+ #endif
  	    if (value)
  	      return value;
  	  }
***************
*** 2626,2638 ****
--- 2856,2876 ----
  	    break;
  
  	  default:
+ #if 1 /* atarist */
+ 	    fprintf(stderr, "Bogus char '%c' found at pos %d of spec '%s'\n",
+ 		c, (p - spec - 1), spec);
+ #endif
  	    abort ();
  	  }
  	break;
  
+ #ifndef atarist
+       /* on the atari it is important to preserve backslash in spec */
+       /* so just let it go into default case */
        case '\\':
  	/* Backslash: treat next character as ordinary.  */
  	c = *p++;
+ #endif
  
  	/* fall through */
        default:
***************
*** 2900,2905 ****
--- 3138,3144 ----
  
  /* On fatal signals, delete all the temporary files.  */
  
+ #ifndef atarist
  static void
  fatal_error (signum)
       int signum;
***************
*** 2911,2916 ****
--- 3150,3156 ----
       so its normal effect occurs.  */
    kill (getpid (), signum);
  }
+ #endif
  
  int
  main (argc, argv)
***************
*** 2924,2929 ****
--- 3164,3174 ----
    char *explicit_link_files;
    char *specs_file;
  
+ #ifdef atarist
+ /* turn this on if you are going to set the TOS 1.4 dont clear heap flag */
+ /*  _malloczero(1); */ 	/* zero mallocs by default */
+   programname = "gcc";
+ #else  
    programname = argv[0];
  
    if (signal (SIGINT, SIG_IGN) != SIG_IGN)
***************
*** 2936,2941 ****
--- 3181,3187 ----
    if (signal (SIGPIPE, SIG_IGN) != SIG_IGN)
      signal (SIGPIPE, fatal_error);
  #endif
+ #endif /* atarist */
  
    argbuf_length = 10;
    argbuf = (char **) xmalloc (argbuf_length * sizeof (char *));
***************
*** 2942,2947 ****
--- 3188,3194 ----
  
    obstack_init (&obstack);
  
+ #if (!(defined(atarist) || defined(CROSSATARI)))
    /* Set up to remember the pathname of gcc and any options
       needed for collect.  */
    obstack_init (&collect_obstack);
***************
*** 2948,2953 ****
--- 3195,3201 ----
    obstack_grow (&collect_obstack, "COLLECT_GCC=", sizeof ("COLLECT_GCC=")-1);
    obstack_grow (&collect_obstack, programname, strlen (programname)+1);
    putenv (obstack_finish (&collect_obstack));
+ #endif
  
    /* Choose directory for temp files.  */
  
***************
*** 2959,2964 ****
--- 3207,3221 ----
  
    process_command (argc, argv);
  
+ #if (defined(atarist) || defined(CROSSATARI))
+   {
+     char *temp;
+     
+     if((temp = getenv ("GCCEXEC")))
+ 	add_prefix (&exec_prefix, temp, 0, 0, 0);
+   }
+ #endif
+   
    /* Initialize the vector of specs to just the default.
       This means one element containing 0s, as a terminator.  */
  
***************
*** 2966,2971 ****
--- 3223,3232 ----
    bcopy (default_compilers, compilers, sizeof default_compilers);
    n_compilers = n_default_compilers;
  
+ 
+ #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
+   specs_file = 0;
+ #else
    /* Read specs from a file if there is one.  */
  
    machine_suffix = concat (spec_machine, "/", concat (spec_version, "/", ""));
***************
*** 2974,2979 ****
--- 3235,3241 ----
    /* Read the specs file unless it is a default one.  */
    if (specs_file != 0 && strcmp (specs_file, "specs"))
      read_specs (specs_file);
+ #endif
  
    /* If not cross-compiling, look for startfiles in the standard places.  */
    /* The fact that these are done here, after reading the specs file,
***************
*** 3013,3019 ****
--- 3275,3287 ----
  
    if (verbose_flag)
      {
+ #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
+ #include "PatchLev.h"
+       fprintf (stderr, "gcc-atariST version %s Patchlevel %s\n",
+ 	       version_string, PatchLevel);
+ #else
        fprintf (stderr, "gcc version %s\n", version_string);
+ #endif
        if (n_infiles == 0)
  	exit (0);
      }
***************
*** 3060,3066 ****
--- 3328,3339 ----
  
  	  input_basename = input_filename;
  	  for (p = input_filename; *p; p++)
+ #ifdef atarist
+ 		if (((*p == '/') || (*p == '\\')) && (*(p-1) != ':'))
+ 		    /* allow both '\' and '/' with  our new lib */
+ #else
  	    if (*p == '/')
+ #endif
  	      input_basename = p + 1;
  
  	  /* Find a suffix starting with the last period,
***************
*** 3107,3112 ****
--- 3380,3386 ----
        int i;
        int first_time;
  
+ #if (!(defined(atarist) || defined(CROSSATARI)))
        /* Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables
  	 for collect.  */
        putenv_from_prefixes (&exec_prefix, "COMPILER_PATH=");
***************
*** 3137,3142 ****
--- 3411,3417 ----
  	}
        obstack_grow (&collect_obstack, "\0", 1);
        putenv (obstack_finish (&collect_obstack));
+ #endif
  
        value = do_spec (link_command_spec);
        if (value < 0)
*** 1.1	1992/03/27 21:49:26
--- getpwd.c	1992/03/28 03:12:41
***************
*** 14,20 ****
     BSD systems) now provides getcwd as called for by POSIX.  Allow for
     the few exceptions to the general rule here.  */
  
! #if !(defined (POSIX) || defined (USG) || defined (VMS))
  #include <sys/param.h>
  extern char *getwd ();
  #define getcwd(buf,len) getwd(buf)
--- 14,20 ----
     BSD systems) now provides getcwd as called for by POSIX.  Allow for
     the few exceptions to the general rule here.  */
  
! #if !(defined (POSIX) || defined (USG) || defined (VMS) || defined(atarist))
  #include <sys/param.h>
  extern char *getwd ();
  #define getcwd(buf,len) getwd(buf)
***************
*** 46,56 ****
    if (!p && !(errno = failure_errno))
      {
        if (! ((p = getenv ("PWD")) != 0
  	     && *p == '/'
  	     && stat (p, &pwdstat) == 0
  	     && stat (".", &dotstat) == 0
  	     && dotstat.st_ino == pwdstat.st_ino
! 	     && dotstat.st_dev == pwdstat.st_dev))
  
  	/* The shortcut didn't work.  Try the slow, ``sure'' way.  */
  	for (s = GUESSPATHLEN;  ! getcwd (p = xmalloc (s), s);  s *= 2)
--- 46,59 ----
    if (!p && !(errno = failure_errno))
      {
        if (! ((p = getenv ("PWD")) != 0
+ #ifndef atarist
  	     && *p == '/'
  	     && stat (p, &pwdstat) == 0
  	     && stat (".", &dotstat) == 0
  	     && dotstat.st_ino == pwdstat.st_ino
! 	     && dotstat.st_dev == pwdstat.st_dev
! #endif
! 	     ))
  
  	/* The shortcut didn't work.  Try the slow, ``sure'' way.  */
  	for (s = GUESSPATHLEN;  ! getcwd (p = xmalloc (s), s);  s *= 2)
*** 1.3	1992/03/27 21:49:26
--- toplev.c	1992/03/28 01:55:06
***************
*** 31,37 ****
  
  #include <sys/stat.h>
  
! #ifdef USG
  #undef FLOAT
  #include <sys/param.h>
  /* This is for hpux.  It is a real screw.  They should change hpux.  */
--- 31,37 ----
  
  #include <sys/stat.h>
  
! #if defined(USG) || defined(CROSSHPUX)
  #undef FLOAT
  #include <sys/param.h>
  /* This is for hpux.  It is a real screw.  They should change hpux.  */
***************
*** 41,49 ****
--- 41,57 ----
  #undef FFS  /* Some systems define this in param.h.  */
  #else
  #ifndef VMS
+ #if (!(defined(atarist) || defined(atariminix)))
  #include <sys/time.h>
  #include <sys/resource.h>
+ #endif /* !(atarist || atariminix) */
+ #endif
  #endif
+ 
+ #ifdef atariminix
+ #include <sys/times.h>
+ /* #include <minix/const.h>, avoid dragging this in */
+ #define HZ 60	/* this is the only thing needed from minix/const.h */
  #endif
  
  #include "input.h"
***************
*** 57,62 ****
--- 65,79 ----
  #include "xcoffout.h"
  #endif
  
+ #ifdef atarist
+ long _stksize = -1L;	/* for all sizes of ST's */
+ 	/* -1 means malloc from own heap and keep all  of memory */
+ #endif /* atarist */
+ 
+ #if (defined(atarist) || defined(atariminix))
+ #include "astab.h"	/* need this for ASM_OUTPUT_SOURCE_FILENAME */
+ #endif
+ 
  #ifdef VMS
  /* The extra parameters substantially improve the I/O performance.  */
  static FILE *
***************
*** 586,592 ****
  int
  get_run_time ()
  {
! #ifdef USG
    struct tms tms;
  #else
  #ifndef VMS
--- 603,612 ----
  int
  get_run_time ()
  {
! #ifdef atarist
!   long now;
! #else
! #if (defined(USG) || defined(atariminix) || defined(CROSSHPUX))
    struct tms tms;
  #else
  #ifndef VMS
***************
*** 601,611 ****
      } vms_times;
  #endif
  #endif
  
    if (quiet_flag)
      return 0;
  
! #ifdef USG
    times (&tms);
    return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
  #else
--- 621,635 ----
      } vms_times;
  #endif
  #endif
+ #endif
  
    if (quiet_flag)
      return 0;
  
! #ifdef atarist
!   return(time(NULL) * 1000000);
! #else
! #if (defined(USG) || defined(atariminix) || defined(CROSSHPUX))
    times (&tms);
    return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
  #else
***************
*** 618,623 ****
--- 642,648 ----
    return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
  #endif
  #endif
+ #endif
  }
  
  #define TIMEVAR(VAR, BODY)    \
***************
*** 1220,1225 ****
--- 1245,1251 ----
    longjmp (float_handler, 1);
  }
  
+ #ifndef atarist
  /* Handler for SIGPIPE.  */
  
  static void
***************
*** 1229,1234 ****
--- 1255,1261 ----
  {
    fatal ("output pipe has been closed");
  }
+ #endif
  
  /* Strip off a legitimate source ending from the input string NAME of
     length LEN. */
***************
*** 1378,1384 ****
--- 1405,1415 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".jump");
+ #else
+       strcat (dumpname, ".jmp");
+ #endif
        jump_opt_dump_file = fopen (dumpname, "w");
        if (jump_opt_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1400,1406 ****
--- 1431,1441 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".loop");
+ #else
+       strcat (dumpname, ".lop");
+ #endif
        loop_dump_file = fopen (dumpname, "w");
        if (loop_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1411,1417 ****
--- 1446,1456 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".cse2");
+ #else
+       strcat (dumpname, ".cs2");
+ #endif
        cse2_dump_file = fopen (dumpname, "w");
        if (cse2_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1422,1428 ****
--- 1461,1471 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".flow");
+ #else
+       strcat (dumpname, ".flo");
+ #endif
        flow_dump_file = fopen (dumpname, "w");
        if (flow_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1433,1439 ****
--- 1476,1486 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 10);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".combine");
+ #else
+       strcat (dumpname, ".cmb");
+ #endif
        combine_dump_file = fopen (dumpname, "w");
        if (combine_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1444,1450 ****
--- 1491,1501 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".sched");
+ #else
+       strcat (dumpname, ".sch");
+ #endif
        sched_dump_file = fopen (dumpname, "w");
        if (sched_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1455,1461 ****
--- 1506,1516 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".lreg");
+ #else
+       strcat (dumpname, ".lrg");
+ #endif
        local_reg_dump_file = fopen (dumpname, "w");
        if (local_reg_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1466,1472 ****
--- 1521,1531 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".greg");
+ #else
+       strcat (dumpname, ".grg");
+ #endif
        global_reg_dump_file = fopen (dumpname, "w");
        if (global_reg_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1477,1483 ****
--- 1536,1546 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 8);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".sched2");
+ #else
+       strcat (dumpname, ".sc2");
+ #endif
        sched2_dump_file = fopen (dumpname, "w");
        if (sched2_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1488,1494 ****
--- 1551,1561 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".jump2");
+ #else
+       strcat (dumpname, ".jp2");
+ #endif
        jump2_opt_dump_file = fopen (dumpname, "w");
        if (jump2_opt_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1512,1518 ****
--- 1579,1589 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 10);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".stack");
+ #else
+       strcat (dumpname, ".stk");
+ #endif
        stack_reg_dump_file = fopen (dumpname, "w");
        if (stack_reg_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 2506,2517 ****
--- 2577,2598 ----
    int version_flag = 0;
    char *p;
  
+ #ifdef atarist
+ /* turn this on if you are going to set the TOS 1.4 dont clear heap flag */
+ /*  _malloczero(1); */ 	/* zero mallocs by default */
+ #endif  
+ 
    /* save in case md file wants to emit args as a comment.  */
    save_argc = argc;
    save_argv = argv;
  
    p = argv[0] + strlen (argv[0]);
+ #ifndef atarist
    while (p != argv[0] && p[-1] != '/') --p;
+ #else
+   while (p != argv[0] && ( ((p[-1] != '/') || (p[-1] != '\\')) &&
+ 			  (p[-2] != ':') ) ) --p;
+ #endif
    progname = p;
  
  #ifdef RLIMIT_STACK
***************
*** 2528,2534 ****
--- 2609,2617 ----
  
    signal (SIGFPE, float_signal);
  
+ #ifndef atarist
    signal (SIGPIPE, pipe_closed);
+ #endif
  
    decl_printable_name = decl_name;
    lang_expand_expr = (struct rtx_def *(*)()) do_abort;
***************
*** 2614,2619 ****
--- 2697,2712 ----
  	  else if (!strcmp (str, "dumpbase"))
  	    {
  	      dump_base_name = argv[++i];
+ #ifdef atarist
+ /* dump_base_name will typically be 'foo.c' here.  Need to truncate at the '.',
+    cause dots mean something here */
+ 	    {
+ 	      char * n = dump_base_name;
+ 	      for ( ; ((*n) && (*n != '.')) ; )
+ 		n++;
+ 	      *n = '\0';
+ 	    }
+ #endif
  	    }
  	  else if (str[0] == 'd')
  	    {
***************
*** 2990,2996 ****
--- 3083,3095 ----
       option flags in use.  */
    if (version_flag)
      {
+ #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
+ #include "PatchLev.h"
+ 	    fprintf (stderr, "%s version %s-atariST Patchlevel %s",
+ 		 language_string, version_string, PatchLevel);
+ #else
        fprintf (stderr, "%s version %s", language_string, version_string);
+ #endif
  #ifdef TARGET_VERSION
        TARGET_VERSION;
  #endif
***************
*** 3011,3016 ****
--- 3110,3117 ----
  
    compile_file (filename);
  
+ #if (!(defined(atarist) || defined(atariminix)))
+ #if (!(defined(CROSSHPUX)))
  #ifndef VMS
    if (flag_print_mem)
      {
***************
*** 3027,3032 ****
--- 3128,3135 ----
  #endif /* not USG */
      }
  #endif /* not VMS */
+ #endif
+ #endif
  
    if (errorcount)
      exit (FATAL_EXIT_CODE);
***************
*** 3138,3140 ****
--- 3241,3274 ----
  
    fprintf (stderr, "\n");
  }
+ 
+ #ifdef atarist
+ void atari_output_filename(file, filename)
+ FILE *file;
+ char *filename;
+ {
+     if( (!file) || (!filename) ) return;
+     for(; *filename; filename++)
+     {
+ 	if(*filename == '\\') putc('\\', file);
+ 	putc(*filename, file);
+     }
+ }
+ 
+ #include <string.h>
+ 
+ char *atari_filename_nondirectory(p)
+ char *p;
+ {
+     char *s;
+     
+     for(s = p + strlen(p); s != p; --s)
+     {
+ 	if((*s == '/') || (*s == '\\'))
+ 	    break;
+     }
+     
+     return (s == p) ? p : s+1;
+ }
+ 
+ #endif
